package com.makatech.mcs.srv.model.common;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

public class PokerDeck extends AbstractCardDeck {
	public final static int TOTAL_CARD_COUNT=52;
	private ArrayList<Card> deck;
	
	public PokerDeck() {
		deck = new ArrayList<Card>(TOTAL_CARD_COUNT);
		for(CardSuitEnum suit : CardSuitEnum.values() ) {
			for(CardRankEnum rank : CardRankEnum.values()) {
				deck.add(new Card(rank, suit));
			}
		}
	}
	
	
	@Override
	public Collection<Card> draw(int count) {
		ArrayList<Card> drawCards = new ArrayList<Card>(count);
		while(count > 0) {
			 drawCards.add(deck.remove(0));
			 count--;
		}
		return drawCards;
	}

	public Card draw() {
		return draw(1).iterator().next();
	}
	
	public void burn() {
		draw();
	}

	@Override
	public int getRemainingCount() {
		return deck.size();
	}

	@Override
	public int getTotalCount() {
		return TOTAL_CARD_COUNT;
	}

	@Override
	public Collection<Card> getAllRemainingCards() {
		return deck;
	}

	
}
